home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / src / out-of-phase-102-c / OutOfPhase 1.02 Source / OutOfPhase Folder / Level 0 Macintosh 29Sep94 / SoundOutput.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-23  |  1.9 KB  |  46 lines  |  [TEXT/KAHL]

  1. /* SoundOutput.h */
  2.  
  3. #ifndef Included_SoundOutput_h
  4. #define Included_SoundOutput_h
  5.  
  6. /* SoundOutput module depends on */
  7. /* MiscInfo.h */
  8. /* Definitions */
  9. /* Debug */
  10. /* Audit */
  11. /* Memory */
  12.  
  13. typedef enum {eStereo EXECUTE(= -28741), eMono} SoundOutputStereo;
  14.  
  15. typedef enum {e8bit EXECUTE(= -14274), e16bit} SoundOutputNumBits;
  16.  
  17. /* attempt to obtain a sound channel.  returns True if the sound channel was opened */
  18. /* or False if it couldn't be (if already in use or machine doesn't support sound) */
  19. MyBoolean        OpenSoundChannel(long SamplingRate, SoundOutputStereo WantStereo,
  20.                             SoundOutputNumBits NumBits, long FramesPerBuffer, int MaxNumBuffers,
  21.                             int InitialNumBuffers);
  22.  
  23. /* close the sound channel and clean up the buffers */
  24. void                CloseSoundChannel(void (*Callback)(void* Refcon), void* Refcon);
  25.  
  26. /* obtain a pointer to one of the [nonrelocatable] sound buffers.  Data in this */
  27. /* buffer is interpreted as such:  For 8-bit mono, the buffer is an array of */
  28. /* signed chars.  For 16bit mono, the buffer is an array of short signed integers in */
  29. /* the machine's native endianness.  For 8-bit stereo, the buffer is an array of */
  30. /* 2-byte tuples; the byte lower in memory is the left channel.  For 16-bit stereo, */
  31. /* the buffer is an array of 2-short) tuples, the left channel is lower in memory. */
  32. /* If there are no buffers currently available (and new ones couldn't be allocated) */
  33. /* then it returns NIL */
  34. char*                CheckOutSoundBuffer(void);
  35.  
  36. /* submit a buffer to be queued to the system's sound channel.  The number of frames */
  37. /* in the buffer actually used is specified to allow less than the full buffer to */
  38. /* be used.  If the buffer is full, then the callback is repeatedly called. */
  39. void                SubmitBuffer(char* Buffer, long NumUsedFrames,
  40.                             void (*Callback)(void* Refcon), void* Refcon);
  41.  
  42. /* discard all queued data on the sound channel and close it immediately */
  43. void                KillSoundChannel(void);
  44.  
  45. #endif
  46.